package structural.decorator;

public class EncryptedCloudStream implements IStream {
    private final IStream stream;

    public EncryptedCloudStream(IStream stream) {
        this.stream = stream;
    }

    @Override
    public void write(String data) {
        String encrypt = encrypt(data);
        stream.write(encrypt);
    }

    private String encrypt(String data) {
        // Simple encryption logic (for demonstration purposes)
        return new StringBuilder(data).reverse().toString();
    }
}
